Memory device and host device

ABSTRACT

According to one embodiment, a memory device includes a nonvolatile semiconductor memory having physical storage areas that includes a user area externally accessible and are divided into management units and a control unit. The control unit receives a control command having a first argument to designate a sequential write area and a read command or a write command, assigns a management unit represented by an address of the read command or the write command as the sequential write area, and changes memory access control by judging whether an address of a memory access command to access the user area indicates access in the sequential write area whose size is equivalent to the management unit.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Divisional of U.S. application Ser. No.14/700,625, filed Apr. 30, 2015, which is a Continuation Application ofPCT Application No. PCT/JP2013/0074959, filed Sep. 10, 2013 and basedupon and claims the benefit of priority from Japanese Patent ApplicationNo. 2012-238849, filed Oct. 30, 2012; and No. 2013-166804, Aug. 9, 2013,the entire contents of each of which are incorporated herein byreference.

FIELD

Embodiments described herein relate generally to a memory device and ahost device.

BACKGROUND

Memory devices such as an SD™ card are classified into a plurality ofclasses to facilitate matching between the performance of a memorydevice and that required by a host device. A speed class provides amethod of classifying the performance of memory devices by speed classnumbers and calculating the performance of the memory devices.

The speed class controls the write procedure using specific commands. Todo memory write while maintaining performance, sequential write isperformed in an allocation unit (to be referred to as an AU orsequential write area hereinafter) that is the physical memory area of amemory device. Data needs to be written from the start of an allocationunit. For this reason, an allocation unit in which data has been writtenpartway cannot be used for data recording. Therefore, it is desired toprovide memory device and host device capable of using an allocationunit in which data has been written partway and improving theutilization efficiency of allocation units.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing an example of a memory system to whichthe embodiment is applied.

FIG. 2 is a view showing the user area management unit of a NAND flashmemory.

FIG. 3 is a view showing an example of multi-file recording.

FIG. 4 is a view showing an example of a command format applied to thisembodiment.

FIG. 5 is a view showing an example of the setting of a sequential writearea using a command.

FIG. 6 is a view showing an example of control of an overwrite areausing a command.

FIG. 7 is a view showing an example of control to set the start of adata area using a command.

FIG. 8 is a flowchart showing an example of control to prepare a cardarea using a command.

FIG. 9A is a view showing an example of write in an allocation unit, andFIG. 9B is a flowchart showing an example of a setup sequence.

FIG. 10 is a view showing an example in which the setup sequence shownin FIG. 9B is expressed as a command sequence.

FIG. 11 is a view showing an example in which a card is initialized,subdirectories are created under a root directory, and files arecreated.

FIG. 12 is a view specifically showing the operation of FIG. 11.

FIG. 13 is a view showing an example in which the operation of FIGS. 11and 12 is expressed as a command sequence.

FIG. 14 is a view showing an example in which the operation shown inFIG. 3 is expressed as a command sequence.

FIG. 15 is a view showing an example of performance information and AUsize information of video grade.

DETAILED DESCRIPTION

In general, according to one embodiment, a memory device includes anonvolatile semiconductor memory and a control unit. The nonvolatilesemiconductor memory has a plurality of physical storage areas thatincludes a user area externally accessible and is divided into pluralityof management units. The control unit is configured to control thenonvolatile semiconductor memory. The control unit receives a controlcommand having a first argument to designate a sequential write area anda read command or a write command, assigns a management unit representedby an address of the read command or the write command as the sequentialwrite area, and changes memory access control by judging whether anaddress of a memory access command to access the user area indicatesaccess in the sequential write area whose size is equivalent to themanagement unit.

The embodiment will now be described with reference to the accompanyingdrawings.

FIG. 1 schematically showing a memory system according to theembodiment.

The memory system includes a memory device 11 (to be also referred to asa card hereinafter) such as an SD card, and a host device 20.

The host device 20 and the memory device 11 are connected by SD BusInterface 26 to communicate using commands. The memory device 11 canindicate busy to host through SD Bus Interface. Busy indication meansthat card is executing something and prevents host from issuing a nextcommand.

When connected to the host device 20, the memory device 11 receivespower and operates to perform processing corresponding to access fromthe host device 20. The memory device 11 includes a controller 11 a.

The controller 11 a includes, for example, a host interface (I/F) 12, aCPU 13, a read only memory (ROM) 14, a random access memory (RAM) 15serving as a volatile memory, a buffer 16, and a memory interface (I/F)17. These are connected by a bus. The memory interface 17 is connectedto, for example, a NAND flash memory 18 and an I/O 19 serving as anextension function unit. For example, a wireless LAN device or the likecan be applied to the extension function unit.

The host interface 12 performs interface processing between thecontroller 11 a and the host device 20. The host interface 12 includes aregister 12 a. The register 12 a stores data unique to the memory device11 such as the size of an AU to be described later. The register 12 aalso stores status during execution. Default setting is read out fromthe NAND flash memory 18 and set in the register 12 a at the time ofpower-on. The contents of the register 12 a are read out by a command,for example, the status can be read by CMD13 issued by the host device20.

The memory interface 17 performs interface processing between thecontroller 11 a and the NAND flash memory 18 or I/O 19. Data of the hostinterface 12, the RAM 15, the buffer 16, and the like can be transferrednot only by data transfer of the CPU 13 but also by DMA transfer ofhardware.

The CPU 13 controls the operation of the entire memory device 11. TheCPU 13 loads firmware (control program or the like) stored in the ROM 14or firmware recorded in the NAND flash memory 18 onto the RAM 15 andexecutes predetermined processing. That is, the CPU 13 creates variouskinds of tables and, for example, an extended register on the RAM 15and, upon receiving a write command, a read command, or an erase commandfrom the host device 20, accesses an area on the NAND flash memory 18 orcontrols data transfer processing via the buffer 16.

The ROM 14 stores firmware such as a control program to be used by theCPU 13. Some pieces of firmware may be implemented in the ROM 14,whereas the remaining pieces of firmware may be stored in the NAND flashmemory 18, extracted to the RAM 15, and executed. The RAM 15 is used asthe work area of the CPU 13, and stores control programs, various kindsof tables, and extended registers.

The buffer 16 temporarily stores a predetermined amount of data (forexample, data of one page) when data sent from the host device 20 is tobe written in the NAND flash memory 18, or temporarily stores apredetermined amount of data when data read out from the NAND flashmemory 18 is to be sent to the host device 20. Intervening the buffer 16enables asynchronous control of an SD bus interface and a back end.

The NAND flash memory 18 includes memory cells having, for example, astacked gate structure or memory cells having a MONOS structure.

The I/O 19 has the function of a peripheral device or an interface for adigital camera, a PHS, or the like. For example, when a wireless LANdevice is applied as the I/O 19, even a digital camera having nowireless communication function can perform wireless data communicationwith an external server or an external PC (Personal Computer).

As the host device 20, for example, a digital camera, a PHS, or the likeis applicable. The host device 20 includes a host controller 21, a CPU22, a ROM 23, a RAM 24, and, for example, a hard disk 25 (including anSSD). These are connected by a bus.

The CPU 22 controls the entire host device 20. The ROM 23 storesfirmware necessary for the operation of the CPU 22. Firmware read outfrom a storage device (e.g., HDD 25) may be stored in the RAM 24 toconstitute a system without the ROM 23. The RAM 24 is used as, forexample, the work area of the CPU 22. Programs executable by the CPU 22are also loaded and executed here. The hard disk (HDD) 25 holds variouskinds of data. The host controller 21 performs interface processing forthe memory device 11 in a state in which the memory device 11 isconnected. The host controller 21 also issues various kinds of commandsto be described later in accordance with an instruction from the CPU 22.

Moreover, the host device 20 has the memory management software which isconfigured to recognize a file system that formats a user area of NANDflash memory 18, stored in the hard disk 25, for example. The memorymanagement software determines whether to write data in a sequentialwrite area or an overwrite area, based on the extension of the file nameor a data length of a file which will be created.

FIG. 2 shows the management unit of a user area 18 a usable by the userout of the areas of the NAND flash memory 18. The user area 18 a of theNAND flash memory 18, which is an area externally accessible using acommand, is divided into a plurality of AUs. The size of each of AU1 toAUn is determined based on the physical boundaries of the NAND flashmemory 18 (the boundaries are not equivalent to those managed by thefile system in the user area). Multiplying the AU size by n (integer)yields the whole memory capacity of the user area 18 a.

The information of the file system such as a file allocation table (FAT)is normally recorded in AU1 at the start. For this reason, writeperformance for AU1 is not guaranteed. (If AU2 is free AU,) AU2 to AUnare recording areas of guaranteed performance, and are indicated asrecordable areas. However, AUs to record directory entry or overwriteare excluded from performance guarantee. If the AU size is small, andthe information of the file system is recorded in, for example, AU1 toAUp, AU(p+1) to AUn are recording areas of guaranteed performance.

In addition, each AU is divided into a plurality of recording units (tobe referred to as RUs hereinafter). Performance is guaranteed forsequential write of continuously writing data whose address is on RUboundary and data length is at least equal to or more than the RU size.For this reason, the host device 20 needs to execute multi-block writein a unit corresponding to an integer multiple of the RU. This isbecause certain data length is needed to make the effect of the pipelineoperation in the card appear in the performance.

FIG. 2 indicates that one AU is formed from m RUs. Letting S_(RU) be thesize of the RU, and S_(AU) be the size of the AU, the number m of RUs inone AU=N_(RU) is given by S_(AU)/S_(RU).

The worst value of average performance when sequential write isperformed for an arbitrary AU is represented by a write performanceinformation Pw of the memory device. When the AU size exceeds 4 MB, Pwis defined as the worst value of average performance of 4-MB areasobtained by dividing the AU into 4-MB areas.

The host device 20 can read out Pw and the AU size S_(AU) from, forexample, the register 12 a of the memory device and use them forperformance calculation. RU size is defined as a fixed value.

(Performance Estimation in Writing Plurality of Files)

The minimum average performance of sequential write for an arearepresented by an AU address and an AU size can be estimated from Pw.Since the values of Pw and AU size change between devices, the hostdevice 20 needs to cope with this by reading out the Pw and AU size fromthe register 12 a of the memory device.

An example of the performance estimation method for a memory devicehaving performance Pw=10 MB/sec will be described here. When the memoryaccess time of a device is managed using time slots, this device can beconsidered to be able to write data of at least 10 MB in each time slotof 1 sec. When performing recording at average performance of 4 MB/sec,4-MB data needs to be written somewhere in the 1-sec time slot.

When time-divisionally writing three files, the write performance ofeach file can be adjusted by adjusting the data write amount in the1-sec time slot. When writing each of the three files at 3 MB/sec, theyare divisionally written as 3-MB data each in the 1-sec time slot. Theremaining 100 ms of the time slot can be assigned to part of time toupdate the FAT as a margin necessary for control on the host deviceside. That is, the host device can calculate and control the writeperformance of a plurality of files by determining the number of timeslots to be assigned and time-divisionally performing write.

(Example of Multi-File Recording)

FIG. 3 shows an example of multi-file recording for the user area 18 aof the NAND flash memory 18.

Referring to FIG. 3, the overwrite area (OverW-Area) is assigned by acommand (CMD20) “Set Over-Write Area” to be described later. An area (tobe referred to as a sequential write area hereinafter) to performsequential write is assigned by a CMD20 “Set Sequential-Write AU”.

One sequential write area can be assigned by the CMD20 “SetSequential-Write AU”. The host device 20 can divisionally write aplurality of files in the sequential write area.

Referring to FIG. 3, three file entries FE1, FE2, and FE3 are created ina directory entry DIR1 of the overwrite area (OverW-Area), and a fileentry FE4 is created in a directory entry DIR2.

In the sequential write area SeqW-AU, File 1 a is part of File 1 and iswritten on the RU basis while being made to match the RU boundary. Forthis reason, at least the performance Pw is guaranteed when writing File1 a.

Each of File 2 and File 3 has a size equal to or smaller than the RU andis written in a data size smaller than the RU. The data exist on, forexample, 64-KB boundaries smaller than the RU boundary. When writingFile 2 and File 3, since the data lengths are smaller than the RU size,the performance Pw is not guaranteed.

If File 4 needs to be written while guaranteeing at least theperformance Pw, first, dummy data is written up to the RU boundary asPadding following File 3. Padding may be done by host or done by card.Next, File 4 is written while being made to match the RU boundary. Thatis, since the data of File 4 is written on the RU basis while being madeto match the RU boundary, the performance Pw is guaranteed.

File 1 b that is the rest of File 1 is written next to File 4. When File1 b is written on the RU basis while being made to match the RUboundary, at least the performance Pw is guaranteed. That is, the hostdevice 20 manages the write performance of File 1 and File 4 by dividingthem to a multiple of RU unit.

Although not illustrated, FAT update is executed to close File 1. A FATarea and bitmap (not shown) are updated, and 512 bytes including thefile entry 1 (FE1) in the DIR area are updated, thereby determining thewrite data partway through File 1 as the file system. The host can thusread out data up to the written data of File 1 from the file systeminformation.

FIG. 4 shows an example of the format of the command CMD20 applied tothis embodiment.

In the CMD20 shown in FIG. 4, “S” is the start bit of the command, “T”is a bit representing the transfer direction, “index” indicates thecommand number, which has a bit string to specify that the command is acontrol command such as sequential write.

“SCC” is an argument representing speed class control, which is anoperation designation portion for designating the function or operationof the command. “SCC” is formed from a plurality of bits, and the bitsof “SCC” set various functions of the CMD20.

“OWAS” (Over Write Area Size) is an argument to designate the size ofthe overwrite area.

“CRC7” indicates a cyclic redundancy check code.

“E” is the end bit of the command.

As described above, in the CMD20, the bits of “SCC” set, for example,“Start Recording”, “Update DIR”, “Update CI”, “Set Sequential-Write AU”,“Set Over-Write Area”, “Set Top of Data Area”, and “Arrange Area”.

(Set Sequential-Write AU)

The CMD20 “Set Sequential-Write AU” is a command to assign thesequential write area. This CMD20 “Set Sequential-Write AU” is used incombination with the read command or write command, as will be describedlater.

When the CMD20 “Set Sequential-Write AU” is used in, for example, asetup sequence to prepare for recording, a busy time of, for example, 1sec is allowed as the processing time of the command. When this commandis used during data recording, the allowed busy time is suppressed to,for example, 10 ms.

(Set Over-Write Area)

The CMD20 “Set Over-Write Area” is a command to set the overwrite area.The overwrite area is designated using the CMD20 “Set Over-Write Area”in combination with the read command or write command, and an address. Abusy period of, for example, 100 ms is set in the CMD20 “Set Over-WriteArea”. The overwrite area cannot be assigned in the sequential writearea.

Note that in processing using the CMD20 and the write command/readcommand, memory access control can be, for example, control of the busytime representing that the write command is being processed, control tomaintain data in unwritten areas, or cache control (a method of writingdata in the buffer and arranging the data written the buffer and writingit in the flash memory later, instead of directly writing the data inthe NAND flash memory). In case of using cache, as write busy timevaries a lot for each access, write performance is estimated by anaverage of busy time.

(Set Top of Data Area)

A CMD20 “Set Top of Data Area” is a command to notify the card of thedata area of the file system in combination with the read command. Thecard need not analyze the file system, and can predict the position ofthe DIR area and bitmap. The start address of the data area isdesignated by the CMD20 “Set Top of Data Area” and the read command. Abusy period of, for example, 100 ms is set in the CMD20 “Set Top of DataArea”.

(Arrange Area)

A CMD20 “Arrange Area” is a command to permit the memory device 11 toprepare an area within a specific time, and represents completion ofpreparation by canceling busy of the CMD20. The CMD20 “Arrange Area” issolely used, unlike the other functions of the CMD20. When the CMD20“Arrange Area” is used in the setup sequence, a busy time of, forexample, 1 sec is allowed and when the CMD 20 “Arrange Area” is used indata recording, the allowed busy time is suppressed to, for example, 250ms.

(“OWAS”: Over Write Area Size)

“OWAS” is an argument to designate the size of the overwrite area.

In this embodiment, there are two methods of designating the size of theoverwrite area.

(1) When “OWAS” of CMD20 is set to “0000b”

In this case, the size of the overwrite area is designated by the readoperation range of the CMD18 following the CMD20 or the write operationrange of the CMD25.

For example, when creating a new directory entry area, data “0” needs tobe written in the area for initialization. When the host device 20issues the CMD20 “Set Over-Write Area”+CMD25 and writes data “0”, thecreated directory entry area can be assigned as the overwrite area. Inthe FAT system, however, “0” need not always be written in all bits, anda file entry such as “.” representing the current directory and “..”representing the parent directory can be written by this command.

(2) When “OWAS” of CMD20 is set to “0001b” to “1111b, overwrite areashaving sizes shown in FIG. 4 can be assigned. In this case, the readsize (CMD18) and the write size (CMD25) need to be equal to or smallerthan the set value of “OWAS”.

A memory device supporting the CMD20 of this embodiment can receive aconventional command and convert its interpretation into the command ofthis embodiment. This makes it possible to maintain the compatibility tosome extent.

(Start Recording)

A CMD20 “Start Recording” is a command to designate the sequential writearea first. This “Start Recording” can directly be handled as “SetSequential-Write AU”. This CMD20 can indicate a busy of 1 sec.

“Start Recording” is used only to designate the first AU but not todesignate the following sequential write area. For this reason, an AUthat satisfies the following conditions needs to be assigned as asequential write area. When the multi-block write command CMD25indicates data write to be performed up to the final area on the RUbasis while being made to match the RU boundary, its write destinationis a assigned sequential write area, and when the next CMD25 indicatesdata write to be performed from the start of another AU on the RU basiswhile being made to match the RU boundary, the newly written AU isassigned as the sequential write area.

(Update DIR)

“Update DIR” is issued before the CMD24/25 that updates a 512-byte areathat is part of the directory entry.

If the 512-byte area from the address represented by the CMD24/25 is notassigned as the overwrite area, at least an area including the 512-bytearea from the address represented by the CMD24/25 is assigned as theoverwrite area.

If the 512-byte area from the address represented by the CMD24/25 isalready assigned as the overwrite area, this assignment is maintained,and the CMD20 “Update DIR” need not perform any processing more.

(Update CI)

“Update CI” is used to write small CI (Continuation Information) dataduring the write of stream data such as video data. In this case,“Update CI” is issued before the CMD24/25 to write part of CI data, forexample, 512-byte data.

The next “Update CI” is written in the next 512-byte area at a highpossibility. Hence, when allocating the overwrite area for CI data, arelatively large area is preferably allocated.

If the 512-byte area from the address represented by the CMD24/25 is notassigned as the overwrite area, at least an area including the 512-bytearea from the address represented by the CMD24/25 is assigned as theoverwrite area.

If the 512-byte area from the address represented by the CMD24/25 isalready assigned as the overwrite area, this CMD20 need not perform anyprocessing.

(Detailed Functions of CMD20)

The functions of the CMD20 “Set Sequential-Write AU”, “Set Over-WriteArea”, “Set Top of Data Area”, and “Arrange Area” will be described nextin detail.

(Setting of Sequential Write Area: Set Sequential-Write AU)

Conventionally, an AU in which data has been written partway cannot beused for data recording because of the specifications. For this reason,when the memory device is powered off and then powered on again, thefree area of the AU in which data was written partway last time cannotbe used, and the AU utilization efficiency lowers.

In this embodiment, an AU that has been used partway can be assigned asa sequential write area at the time of initialization.

When a designation method of making an AU used partway usable isprovided, the AU utilization efficiency can be improved.

Since area management of memory card is managed by the host device 20,the card needs not hold assigned information when card is powered off.According to this method, after power is supplied to the card, the hostdevice 20 can re-designate areas equivalent to those before power off.

The sequential write area is valid until one AU has completely beenwritten.

Conventionally, when a random write is issued, sequential write ends,and additional write cannot be done for the AU.

In this embodiment, the assigned AU as the sequential write area cancontinue sequential write even the random writes to another area areinserted. For this reason, additional write can be performed in the freearea of the sequential write area, and the AU utilization efficiency canbe improved.

Setting of the sequential write area SeqW-AU will be described below indetail with reference to FIG. 5.

A command format to allocate the sequential write area SeqW-AU is asfollows.

CMD20 “Set Sequential-Write AU”+CMDxx

One sequential write area SeqW-AU is designated by this command format.

Combinations of the CMD20 “Set Sequential-Write AU” and CMDxx are asfollows.

CMDxx is one of two different commands, for example, a read command(CMD17) and a multi-block write command (CMD25), and the address ofCMDxx indicates the start or a midpoint of an AU. As a result, fourdesignation methods are available.

(Case 1)

When reading out a 512-byte area from the start address of an AU by theCMD17, the AU is assigned as the sequential write area. Data is writtenfrom the start of the sequential write area. Read data should bediscarded due to it is meaningless.

(Case 2)

When reading out a 512-byte area from a middle address of an AU by theCMD17, the AU is assigned as the sequential write area. Data is writtenfrom the designated address. Data recorded in the area before thedesignated address is preserved. Read data should be discarded due to itis meaningless.

(Case 3)

When writing data from the start address of an AU by the CMD25, the AUis assigned as the sequential write area. Data is written from the startof the AU, and subsequent data is written from the address immediatelyafter the written data.

(Case 4)

When writing data from a middle address of an AU by the CMD25, the AU isassigned as the sequential write area. Data is written from thedesignated middle address of the AU, and subsequent data is written fromthe address immediately after the written data. Data recorded in thearea before the designated address is preserved.

(Period of Validity of Sequential Write Area)

The validity of the sequential write area is canceled when a new area isdesignated by the next CMD20 “Set Sequential-Write AU”+CMDxx.

When data has been written up to the end of the allocated sequentialwrite area, the assignment is canceled.

When the memory device 11 is powered off, assignment of the sequentialwrite area can be either held or canceled. Assignment is canceled evenupon judging that write in the sequential write area is not sequential(overwrite has occurred). Assignment is also canceled if host assignsanother area sequential write area.

(Setting of Overwrite Area: Set Over-Write Area)

As described above, the CMD20 “Set Over-Write Area” is a command to setan overwrite area. Random write data may be temporarily saved in thecache. However, since the whole user area can be subjected to randomwrite, occurrence of cache flash may make the processing time very long.For this reason, the memory device 11 indicates long busy, and aphenomenon called “a petit freeze” may occur. In particular, the largerthe block size (the physical data length serving as the base indetermining the AU size) of the flash memory is, the longer the busytime tends to be because of the wide area to manage data. This poses anespecially serious problem in a flash memory having a large block.

In this embodiment, the area of overwrite is designated. This makes itpossible to reduce the influence of cache flash and, even in the worstcase, estimate the processing time short, and prevent the card fromindicating long busy.

For this reason, in this embodiment, a plurality of overwrite areas canbe assigned. In addition, the busy time is predetermined, and timerequired for assignment is ensured.

The overwrite area is designated using the CMD20+read/write command andan address.

To designate the size of the overwrite area, for example, the followingtwo methods are usable.

(1) A method of designating the size by CMD20

(2) A method of designating the size by a data area that has undergoneread/write

The method (1) (described as the argument OWAS of the CMD20) iseffective when designating large areas together as an overwrite area.When a directory entry is created for the first time, data “0” needs tobe written in the allocated area for initialization. Hence, in thiscase, the method (2) is effective.

Note that when writing data in an undesignated area, the write commandmay indicate a long busy. For example, the maximum busy time is set to500 ms for the undesignated area with respect to the maximum busy timeof 250 ms for the overwrite area. This means that the cache controlmethod for the overwrite area and that for the undesignated area aredifferent. Hence, when the address of a command to access an AUindicates access to an overwrite area, the memory device changes memoryaccess control, for example, cache control to control different fromthat for areas other than the overwrite area. That is, the host devicetherefore designates the sequential write area and the overwrite areaand performs write in the area. This allows the memory device to doefficient processing and improve total performance.

An overwrite area designation method will be described below in detailwith reference to FIG. 6.

A command format to allocate the overwrite area is as follows.

CMD20 “Set Over-Write Area”+CMDxx

One overwrite area is designated by this format. For example, the cardcan assign eight overwrite areas at maximum. When eight or moreoverwrite areas are designated, the latest eight areas are valid asoverwrite areas.

Combinations of CMD20 and CMDxx are as follows.

CMDxx is, for example, a multi-block read command CMD18 or a multi-blockwrite command CMD25, and there are two different designation methods(the command may be a single write command CMD24 or a single readcommand CMD17).

To designate the size of the area, a method of designating the size bythe argument of the CMD20 to be described later or a method ofdesignating the size by the area accessed by CMDxx is usable.

(Case 1)

As shown in FIG. 6, when writing data from a middle address of an AU bythe CMD25, part of the AU is assigned as the overwrite area, and data iswritten from the designated address. The overwrite area is designated bya set value represented by the argument OWAS of the CMD20 or a datalength written by the CMD25. In the designated overwrite area, data inan area other than the written area is preserved.

(Case 2)

As shown in FIG. 6, when reading out 512-byte data from a middle addressof an AU by the CMD18, part of the AU is assigned as the overwrite area,and data is read out from the designated address. The overwrite area isdesignated by a set value represented by the argument OWAS of the CMD20or a data length read by the CMD18. Data in the designated overwritearea is preserved.

As described above, when an overwrite area is added by the CMD20 “SetOver-Write Area”+CMDxx, if the upper limit is set for the assignmentcount, the overwrite areas assigned latest are maintained as theoverwrite areas and older one may be removed from assignment so thattotal assignment count is restricted by the upper limit.

When the memory device 11 is powered off, assignment of the overwritearea can be either held or canceled.

(Improvement of Setup Sequence: Set Top of Data Area)

As described above, the CMD20 “Set Top of Data Area” is a command tonotify the card of the data area of the file system.

The host device 20 notifies the card of the start position of the dataarea representing the format of the file system. The card can thusspecify the bitmap area and FAT area of exFAT (extended FAT).

In exFAT complying with the SD standard file system, the host device 20can read out a bitmap to the RAM 24 using a read command following theCMD20 “Set Top of Data Area” and form cache of the bitmap in RAM 24.

Conventionally, a recording area is defined by the write command. Hence,preparation of the recording area cannot be done without startingrecording.

In this embodiment, the recording area is designated by the address ofthe read command, thereby enabling preparation.

As described above, one area can be assigned as the sequential writearea, and a plurality of areas can be assigned as the overwrite areas.

The host device 20 issues a command to permit the memory device 11 toprepare an area. The memory device 11 indicates busy during thepreparation according to the command, thereby notifying the host device20 that preparation is progressing.

A method of designating the start position of a data area will bedescribed below in detail with reference to FIG. 7.

FIG. 7 shows the memory map of the NAND flash memory 18. In exFATcomplying with the SD standard file system, the user area 18 a of theNAND flash memory 18 includes a file system area including a FAT beforethe start position of the data area, and includes a bitmap area withinthe first 4-MB area of the data area.

The host device 20 searches for the start address of the data area fromthe file system format of the memory device 11, and designates the startaddress of the data area by the CMD20 “Set Top of Data Area”+CMD18.

The memory device 11 can predict the position of directory informationrecorded in the file system area and the position of bitmap informationwithin the first 4-MB area of the data area from the address designatedby the CMD18.

Note that as for the directory area and the bitmap area, the host device20 is not necessary to set these areas as an overwrite area but can beset these areas as an overwrite area in accordance with a simplerprocedure of Set Top of Data Area. These areas are not included in thecount of Overwrite Area assignment.

(Area Management: Area Management Method)

Areas to be used are distinguished by the type of data and the datalength. That is, the data length of a file can be predicted by theextension of the file name or file attribute. For example, a video filecan be handled as long data, and a text file can be handled as shortdata assumed to be rewritten. The extension of the file name or fileattribute can be used as a means for predicting the data length orwhether to overwrite even when the data length is indefinite.

Data associated with the file system, for example, a FAT, bitmap, ordirectory entry can be handled as short data and is recorded in theoverwrite area.

Rewritable short data is recorded in the overwrite area, and rewritablelong data is recorded in the sequential write area.

On the other hand, long data or short data assumed not to be rewrittenis recorded in the sequential write area.

For example, data equal to or larger than RU=512 Kbytes is handled aslong data.

The minimum unit of the sequential write area is set to 64 Kbytes(determined by the page size), and data smaller than 64 Kbytes ishandled as short data.

The sequential write of short data is not limited to the RU basis (datasize is multiple of RU Size and address is on RU boundary).

When data is written in the RU basis, the performance is equal or higherthan Pw. Although data can also be written in a unit smaller than theRU, the performance becomes lower than Pw. “Pw becomes lower” means thatthe busy time indicated by the memory device becomes longer. For writein the sequential write area, the memory device confirms whether theaddress is sequential and whether the write data exists on the RUboundary, and controls the busy time depending on whether the conditionsto yield the performance Pw are met. If the area is not the sequentialwrite area, there is no restriction on the performance Pw, andtherefore, another busy control is performed. That is, the memory devicejudges, for a command to access an AU, whether the address indicatesaccess to the sequential write area, and changes memory access control,for example, busy time.

An area management method will be described below in detail withreference to FIG. 8.

As described above, the CMD20 “Arrange Area” is solely used, unlike theother CMD20. The CMD20

“Arrange Area” is a command to permit the memory device 11 to prepare anarea within a specific time, and indicates completion of preparation bycanceling busy of the CMD20.

In, for example, a setup sequence, the CMD20 “Arrange Area” is issued atthe end of area designation.

As shown in FIG. 8, after setup is completed, the overwrite area can bedesignated any time by issuing the CMD20 “Set Over-Write Area”+CMD25 orCMD18 (step S11). After that, the CMD20 “Arrange Area” is issued toprepare an area (step S12). To arrange data cached by random writes toan overwrite area, the card needs a processing time. The processing timecan be ensured by the CMD20 “Arrange Area”, and the design becomes easy.In this case, the allowed busy time is suppressed to 250 ms because, forexample, data recording may be progressing in a host device.

Note that as described above, when the CMD20 and the write command arecombined, not only writing write data but also assigning the areaincluding the data as the sequential write area or the overwrite area isperformed. In addition, the maximum value of the busy time is set foreach function of the CMD20 or each situation of command issuance so thatthe host device can estimate write performance budget. When theoverwrite area or the sequential write area is designated using theCMD20, and write is performed a plurality of times, the card can controlto make the average busy time of each write shorter than that in writinga plurality of times in an area other than the designated area. That is,the average busy time of write using the CMD20 can be controlled to beshorter than the average busy time of write that uses no CMD20.

(Setup Sequence)

FIGS. 9A and 9B show an example of a setup sequence using the CMD20.FIG. 10 shows an example in which the setup sequence shown in FIG. 9B isexpressed as a command sequence. In this example, one sequential writearea and three overwrite areas are designated.

More specifically, first, the memory device (card) is initialized (stepS21). After that, the start address of a data area is designated by theCMD20 “Set Top of Data Area”+CMD18, and the card assigns the DIR areaand the bitmap area as the overwrite area (step S22). Next, thesequential write area is designated by the CMD20 “Set Sequential-WriteArea”+CMD17 (step S23). Next, the overwrite areas are designated by theCMD20 “Set Over-Write Area”+CMD18, the CMD20 “Set Over-WriteArea”+CMD25, and the CMD20 “Set Over-Write Area”+CMD18 (steps S24, S25,and S26). Finally, the CMD20 “Arrange Area” is issued, and the area inthe memory device 11 is prepared during busy indication of the CMD20“Arrange Area” (step S27).

With the above-described operation, one sequential write area and threeoverwrite areas are assigned.

Note that the combinations of the CMD20 and the write command or readcommand are not limited to those shown in FIGS. 9B and 10. By combiningthe CMD20 and the write command or read command, a necessary area can beset from the start or a middle point of an AU, as shown in FIG. 9A.

(Example of File Creation)

FIG. 11 assumes a state in which the subdirectory DIR1 exists under theroot directory, and files X1, X2, and X3 are already created in thesubdirectory DIR1. A case will be described in which the card isinitialized in this state, the subdirectory DIR2 is newly created underthe root directory, File 1 and File 2 are created in DIR1, and File 3 iscreated in DIR2.

FIG. 12 is a view specifically showing an example of file creationaccording to this embodiment shown in FIG. 11. FIG. 13 expresses thefile creation shown in FIG. 12 as a command sequence. The same referencenumerals denote the same parts throughout FIGS. 12 and 13. Note that theFAT, bitmap, and root directory are not illustrated in FIG. 12.

FIGS. 12 and 13 show an example in which two sequential write areasSeqW-AU1 and SeqW-AU2 and DIR Entry 1 and DIR Entry 2 serving as twooverwrite areas are designated, and data are written in these areas.

First, the initialization sequence is executed to initialize the memorydevice 11 (step S41).

Next, the host device 20 analyzes the format of the file system, issuesthe CMD20 “Set Top of Data Area”+CMD18, and designates the start addressof the data area designated by the format (step S42). In exFAT complyingwith the SD standard file system, data read out by the CMD18 can includethe bitmap area. The host device 20 can cache the readout bitmap in thesystem memory (RAM 24).

The host device 20 issues the CMD20 “Set Sequential-Write AU”+CMD18. Thememory device 11 assigns the sequential write area SeqW-AU1 in the NANDflash memory 18 based on the command (step S43). Data can sequentiallybe written from the address position designated by the CMD18 to the endof the AU.

After that, the host device 20 analyzes the format of the file systemand issues the CMD20 “Set Over-Write Area”+CMD25 (step S44). The alreadycreated DIR Entry 1 is thus assigned as an overwrite area by the CMD18.

The host device 20 then issues the CMD20 “Arrange Area” to instruct thememory device 11 to prepare an area (step S45). The memory device 11 ispermitted to use, for example, 1 sec as the time for area preparation.

After that, the file entry FE1 of File 1 is created in the DIR Entry 1,and partial data File la of File 1 is written in the sequential writearea SeqW-AU1 (steps S46 and S47). In this example, all file data arewritten on the RU basis while being made to match the RU boundary.

Next, the file entry FE2 of File 2 is created in the DIR Entry 1, andpartial data File 2 a of File 2 is written in the sequential write areaSeqW-AU1 (steps S48 and S49).

Next, the host device 20 analyzes the format of the file system, andsequentially issues the CMD20 “Set Over-Write Area”+CMD25 and the CMD20“Arrange Area” (steps S50 and S51). The DIR Entry 2 is thus newlyassigned as an overwrite area by the CMD25.

After that, the file entry FE3 of File 3 is created in the DIR Entry 2(step S52), and partial data File 3 a of File 3 is written in thesequential write area SeqW-AU1 (step S53).

Next, subsequent data File 1 b of File 1 is written in the sequentialwrite area SeqW-AU1 (step S54).

Subsequent data File 3 b of File 3 is written in the sequential writearea SeqW-AU1 (step S55).

Subsequent data File 1 c of File 1 is written in the sequential writearea SeqW-AU1 (step S56).

Subsequent data File 2 b of File 2 is written in the sequential writearea SeqW-AU1 (step S57).

When the sequential write area SeqW-AU1 is filled to its capacity, thearea SeqW-AU1 is excluded from the sequential area.

After that, the host device 20 issues the CMD20 “Set Sequential-WriteAU”. The memory device 11 newly assigns the sequential write areaSeqW-AU2 in the NAND flash memory 18 based on the command (step S58).

Next, subsequent data File 1 d of File 1 is written in the sequentialwrite area SeqW-AU2 (step S59). The first CMD25 of step S59 representsthe start address of the area SeqW-AU2, and the data File 1 d is writtenfrom there. This logical address (address accessed from outside) isassigned to the sequential write area SeqW-AU2.

According to the above-described embodiment, the sequential write areaand the overwrite areas can be designated using the arguments “SetSequential-Write AU”, “Set Over-Write Area”, “Set Top of Data Area”, and“Arrange Area” of the CMD20, and data can be written in these areas.

In addition, the AU written partway can be assigned as a sequentialwrite area at the time of initialization. For this reason, the free areain the AU can be used, and the AU utilization efficiency can beimproved.

(Another Example of File Creation)

FIG. 14 expresses an example of file creation shown in FIG. 3 as acommand sequence.

Referring to FIG. 14, steps S61, S62, and S63 are the same as steps S41,S42, and S43 in FIG. 13. The memory device 11 is initialized, the startaddress of a data area designated by the format is designated, and thesequential write area SeqW-AU is designated.

Next, the host device 20 issues the CMD20 “Set Over-Write Area”+CMD18,the CMD20 “Set Over-Write Area”+CMD18, and the CMD20 “Arrange Area” anddesignates the already created DIR Entry 1 and DIR Entry 2 as overwriteareas (steps S64, S65, and S66).

After that, the file entry FE1 of File 1 is written in the DIR Entry 1(step S67), and the partial data File 1 a of File 1 is written in thesequential write area SeqW-AU (step S68).

The file entries FE2 and FE3 are then written in the DIR Entry 1 (stepsS69 and S70), and File 2 and File 3 are written in the sequential writearea SeqW-AU (step S70). Since the performance Pw is unnecessary uponwriting File 2 and File 3, the data are written in a size smaller thanthe RU.

Next, to write subsequent data at least at the performance Pw, dummydata serving as Padding is written in the area following File 3 up tothe RU boundary (step S73). However, Padding is not always necessaryprocessing. The memory device 11 may be configured to automaticallyperform Padding by analyzing the addresses and data lengths of the twomemory write commands. The memory device 11 may automatically startsequential write processing from the write address of File 4.

The file entry FE4 is then written in the DIR Entry 2 (step S74), andFile 4 is written in the sequential write area SeqW-AU (step S75).

Next, the subsequent data File 1 b of File 1 is written in thesequential write area SeqW-AU (step S76). To determine the data of File1 on the file system, FAT update is executed (step S77). In the FATupdate, the first write indicates updating the FAT, the second writeindicates updating the bitmap, and the third write indicates updatingthe file entry FE1. Referring to FIG. 14, when 512-byte data includingthe file entry FE1 is written, the file entry FE1 is updated.

(Performance Information of Video Grade)

FIG. 15 shows the newly defined performance information (VG4, VG6, VG10,VG30) of video grades and AU size information of the video grades.

The AU size of a video grade is represented by a combination of 4MB×2^(n)×3^(m) (n=0, 1, 2, . . . , 6; m=0, 1, 2). To allow the hostdevice to easily manage the areas, 4 MB is used as the basic unit, andthe AU size is designated by a multiple thereof. The NAND flash memory18 stores 2-bit data in one memory cell or 3-bit data in one memorycell. Not only a memory cell having a two-dimensional structure but alsoa memory cell having a three-dimensional structure exists(exponentiation n, m). For this reason, necessary AU sizes can becovered by the above-described expression.

(If Holding Power Supply, State Is Held As Well)

In this embodiment, information of a set sequential write area oroverwrite area is held in the power down mode or hibernate mode.

For this reason, when the device has returned from the power down modeor hibernate mode, area information designated immediately before thepower down mode or hibernate mode has been held, and the area can beused again.

(Conversion of Existing Speed Class Command)

In this embodiment, the CMD20 is extended, thereby defining newfunctions of “Set Sequential-Write AU”, “Set Over-Write Area”, “Set Topof Data Area”, and “Arrange Area”. Since the new functions include theconventional functions, the memory device that has received an existingspeed class command can convert its function into the new function.

That is, the memory device 11 that implements the new functions of theCMD20 implements conversion programs for the existing commands “StartRecording”, “Update DIR”, and “Update CI”, and can perform processingwhile maintaining the compatibility upon receiving the existing speedclass commands.

For example, when the memory device 11 receives the control command“Start Recording”, it is managed as the same as “Set Sequential-WriteAU”. And then another sequential write area is assigned by the followingsequence. The memory device 11 confirms that data is written up to theend of a sequential write area for which the write of the write commandis data write to be performed on the RU basis while being made to matchthe write boundary. If the next write command indicates write to beperformed from the start of another AU on the RU basis while being madeto match the write boundary, the newly written user area is assigned asthe sequential write area.

Upon receiving the control command “Update DIR” indicating the positionof the file system, the memory device 11 assigns an overwrite area bythe address of the subsequent write command, assigns an area in a sizeincluding the area to be written by the write command as the size of theoverwrite area, and if the area has already been assigned as anoverwrite area, maintains the assignment.

Upon receiving the control command “Update CI” indicating the positionto write a part of CI data during recording of the stream data, thememory device 11 assigns, as an overwrite area, an area in a certainsize predicted to write CI data and including the size (512 bytes) of anarea to be written by the write command, and if the area has alreadybeen assigned as an overwrite area, maintains the assignment.

The above-described conversion programs are implemented so that uponreceiving an existing speed class command, the memory device can convertits function into the new function.

While certain embodiments have been described, these embodiments havebeen presented by way of example only, and are not intended to limit thescope of the inventions. Indeed, the novel embodiments described hereinmay be embodied in a variety of other forms; furthermore, variousomissions, substitutions and changes in the form of the embodimentsdescribed herein may be made without departing from the spirit of theinventions. The accompanying claims and their equivalents are intendedto cover such forms or modifications as would fall within the scope andspirit of the inventions.

INDUSTRIAL APPLICABILITY

The embodiment of the present invention is used for, for example, amemory card.

1. A host device comprising: a memory management software configured torecognize a file system that formats a memory device, wherein thesoftware comprises following functions; determining whether to writedata in a sequential write area or an overwrite area, based on theextension of the file name or a data length of a file which will becreated, assigning an user area to a sequential write area and anover-write area by using a first command, the user area being an areafor writing in data; recording long data in the sequential write area;recording short data assumed not to be rewritten in the sequential writearea, recording short data assumed to be rewritten in, the overwritearea, and recording short data related to the file system in theoverwrite area.
 2. The device according to claim 1, wherein thecontroller comprises following functions, discriminating data whose sizeis not less than 512 Kbytes, as the long data, and discriminating datawhose size is less than prescribed size, as the short data.
 3. Thedevice according to claim 2, wherein the prescribed size is 512 Kbytes.4. The device according to claim 1, wherein the first command is acombination of the control command and read command; and the location ofthe area is specified by the address of the read command.
 5. The deviceaccording to claim 1, wherein the first command is a combination of thecontrol command and write command; and the location of the area isspecified by the address of the read command.
 6. The device according toclaim 1, further comprising: recording the data on the sequential writearea, if the file name indicates video file.